Repository navigation
Tools: Test: Audio: Add double quotes to shell scripts - #2606
Conversation
There was a problem hiding this comment.
Did you mean "${FN_IN:-4}" ? If not add a comment explaining why the space is not a typo.
There was a problem hiding this comment.
That's a good catch. I wonder it has not failed -- I need to check what happens.
There was a problem hiding this comment.
Oh, the space needs to be there, it doesn't work with the space removed. It can be also "${FN_IN:(-4)}". I think it's better that way since it works with () with or without space before -4.
There was a problem hiding this comment.
I didn't know about negative offsets, sorry. I should have spent more time on https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
(I also didn't realize offsets were a bashism
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 - I digress)
I'm actually less comfortable with the (-4) than with the space because while confusing the space is documented extensively in the bash manual above but I couldn't find any sign that (-4) is officially supposed to work. Did you? The manual does mention that the offset can be an "arithmetic expression", so could you try ((-4)) if you like it? Otherwise back to the space with a comment to warn the casual reader that it is an offset and not a default value 4 with a typo.
There was a problem hiding this comment.
OK, I'll revert to -4 with space. I saw it in Stack Overflow so it was not proper documentation.
There was a problem hiding this comment.
... but still no comment this is not a typo :-) Never mind, not worth holding the rest back.
|
@marc-hb can you send a PR to add yourself as a codeowner for scripts. |
|
Reran tests, cos there was weird random error that it couldn't find cmocka.h (???), lets see if it helps |
|
Don't merge yet. I'm doing all recommendations by @marc-hb . I'm trying to improve my scripting style even if these are very small scripts. |
a6185a5 to
61a47fc
Compare
|
I just pushed new version with all the fixes. The scripts work and are OK but the testbench has stopped to work again. I'll fix it in another PR. Maybe testbench run step is still missing from CI since it fails to execute rather often. |
|
I was able to fix testbench and made a new PR. Something left not initialized in testbench resulted to crash with updated pipeline code. |
Internal CI does not run testbench (only builds it), so it shouldn't be an issue. |
It would be nice if CI could run e.g. 1s worth of sine wave with with one of these run scripts, e.g. volume_run.sh that's a very simple component. If output file is empty or much shorter than input it means testbench is broken. The execute fail would not need to be a blocker for PR merge but some kind of orange warning and the developer who sees it could contact me. It would help me to faster fix / add things for what the fail is about. Testbench is being used ATM by external processing component developers so it would be nice if we can keep it in usable shape. |
There was a problem hiding this comment.
Nit:
if [ $# -gt 6 ]; then
So you can support a blank $6 argument, which you probably don't want to so forget it :-)
There was a problem hiding this comment.
I guess you meant
if [ $# -ne 6 ]; then
No problem, it's good to do once properly and learn good habits.
There was a problem hiding this comment.
if [ $# -ne 6 ]; then
Yes, thanks for knowing better :-)
There was a problem hiding this comment.
I didn't know about negative offsets, sorry. I should have spent more time on https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
(I also didn't realize offsets were a bashism
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 - I digress)
I'm actually less comfortable with the (-4) than with the space because while confusing the space is documented extensively in the bash manual above but I couldn't find any sign that (-4) is officially supposed to work. Did you? The manual does mention that the offset can be an "arithmetic expression", so could you try ((-4)) if you like it? Otherwise back to the space with a comment to warn the casual reader that it is an offset and not a default value 4 with a typo.
marc-hb
left a comment
There was a problem hiding this comment.
Our current checkpatch version has a very "interesting" bug. If the SPDX is on line 3 you get this
WARNING: Misplaced SPDX-License-Identifier tag - use line 2 instead
... because the shebang obviously needs line 1. But when on line 2 you get this:
WARNING: Misplaced SPDX-License-Identifier tag - use line 1 instead
Maybe it suggests line 0 when on line 1 :-)
It's taken from kernel 3-6 months ago, idk maybe there were som bug. |
Internal CI is not for testing tools (it just uses logger, but there is no test for it). Jenkins is for that AFAIK. |
|
@jajanusz Yeah, I'm happy for Jenkins to also test the tooling. It does need done. @wenqingfu fyi, something to add to your CI list. |
This patch adds the double quotes to shell scripts to avoid fails with arguments or shell variables when there are space characters. The processing components run scripts are all edited for better structure with functions usage() and main() and with local variables within functions. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
61a47fc to
ec0720e
Compare
There was a problem hiding this comment.
... but still no comment this is not a typo :-) Never mind, not worth holding the rest back.
|
Jenkins CI known issues. |
Adding myself per Liam's instruction in PR thesofproject#2606 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Adding myself per Liam's instruction in PR #2606 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch adds the double quotes to shell scripts to avoid fails
with arguments or shell variables when there are space characters.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com